<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>欢迎页面</title>
    <script>
        function getQueryString(str) {
            var url = String(window.document.URL);

            var rs = new RegExp("(^|)" + str + "=([^&]*)(&|$)", "gi").exec(url);
            if (rs === null){
                window.location.href="/webstudy/static/login.html";
            }
            return rs[2];
        }
    </script>
    <style>
        /**
        将p标签转为行内元素
         */
        p {
            display: inline;
        }
    </style>
</head>
<body>
    <p id="name"></p>,欢迎光临
    <script>
        var name = decodeURI(getQueryString("name"));
        document.getElementById("name").innerText = name;
    </script>
</body>
</html>